package com.javaweb.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.javaweb.admin.entity.KdlPurchasein;
import com.javaweb.admin.entity.KdlPurchasewe;
import com.javaweb.admin.entity.KdlPurchaseweB;
import com.javaweb.admin.query.KdlPurchaseinQuery;
import com.javaweb.admin.query.KdlPurchaseweQuery;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;

public interface KdlPurchaseweMapper extends BaseMapper<KdlPurchasewe> {

    @Select("select isnull(convert(varchar(20),max(sync_time),120),'2024-03-28 00:00:00') from kdl_purchasewe_b")
    String GetMaxSyncTime();

    IPage<KdlPurchasewe> getPurchaseweList(IPage<KdlPurchasewe> page, @Param("req") KdlPurchaseweQuery req);

    @Select("select * from v_kdl_purchasewe_b where pid=#{pid} order by sapbatch")
    List<KdlPurchaseweB> getPurchaseweDetail(Integer pid);
}
